﻿@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <title>相册</title>

    <link href="../Css/shop.css" rel="stylesheet" type="text/css" />
    <link href="../../Css/all2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h2>上传图片</h2>
<form  id="form1" runat="server">
    <div class="rightbar mt10">
        <ul class="tittab">
            <li><a hidefocus="" href="#">管理相册</a></li>
            <li class="tcurrent"><a hidefocus="" href="#">上传图片</a></li>
            
        </ul>
        <div class="sellshow">
            <p class="mt5">
                <img src="/images/stepimg.jpg" />
            </p>
            <ul class="photit mt10">
                <li><a href="/Admin/Images/ImgUploadBatch"><span>批量上传</span></a></li>
                <li class="curpho"><a><span>普通上传</span></a></li>
            </ul>
            <div class="tip1 fd-left mt10">
                <p>
                    <span class="light f12">普通上传，每次最多上传3张图片，支持jpg、gif、bmp格式图片，单张图片最大不超过2M</span></p>
            </div>
            <div class="upload">
                <ul>
                    <li><span class="fd-left layer fb">选择相册：</span> <span class="fd-left mt03">
                        <select id="albumselect" name="albumselect">
                             @helper renderAlum()
                                {
                                    System.Data.DataView dv = new System.Data.DataView(@ViewBag.Alum);

                                    foreach (System.Data.DataRowView drv in dv)
                                    {
                                        string id = drv["Id"].ToString();
                                <option value="@id")>
                                    @MvcHtmlString.Create(@drv["Name"].ToString())
                                </option>
                                    }
                            }
                            @renderAlum()
                        </select>
                       
                    </span><span class="under blue pl10"><a href="###" onclick="AddAlbum()">新建相册</a></span>
                    </li>
                    <li><span class="fd-left layer fb">添加图片：</span> <span class="gray-btn wh02 fd-left mt03 ml5">
                        <input runat="server" type="file" id="imgfile1" /></span> </li>
                    <li><span class="fd-left layer fb"></span><span class="gray-btn wh02 fd-left mt03 ml5">
                        <input runat="server" type="file" id="imgfile2" /></span> </li>
                    <li><span class="fd-left layer fb"></span><span class="gray-btn wh02 fd-left mt03 ml5">
                        <input runat="server" type="file" id="imgfile3" /></span> </li>
                    <li>
                        <input id="btnUploadImg"  type="button" value="上 传" class="save-btn fd-left ml65" />
                           @* OnClick="btnUploadImg_Click" />*@
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            $("#btnUploadImg").click(function () {
                alert($.trim($("#albumselect").val()));
                if ($.trim($("#albumselect").val()) == "") {
                    jQuery.dialogHelper.alert("请先创建相册！", "alert");
                }
                if ($("#imgfile1").val() == "" && $("#imgfile2").val() == "" && $("#imgfile3").val() == "") {
                    jQuery.dialogHelper.alert("请至少选择一张图片！", "alert");
                }
                else {
                    return true;
                }
            });
        });
        function AddAlbum() {
            var option = { id: '1231' };
            jQuery.dialogHelper.open("/Admin/Image/AlbumEdit", option);
        }
        function okSuccess() {
            $.dialogHelper.close();
            location.reload();
        }
        function AlbumEdit() {
            $.ajax({
                type: "POST",
                url: "/Admin/Image/AlbumEdit",
                data: { "albumName": $("#txt_AlbumName").val() },
                dataType: "text",
                success: function (result) {
                    jQuery.dialogHelper.close(1231);
                    if (result.indexOf("成功") != -1) {
                        jQuery.dialogHelper.alert(result, "success", "okSuccess");  //状态包括:success,smile,alert
                    } else {
                        jQuery.dialogHelper.alert(result, "alert");
                    }
                },
                error: function () {
                    jQuery.dialogHelper.close(1231);
                    jQuery.dialogHelper.alert("网络忙，请稍后再试！", "alert");
                }
            });
        }
    </script>
</body>
</html>